package io;

import java.io.*;

/**
 * 文件复制
 */
public class CopyDemo {
    public static void main(String[] args) throws IOException {
        //输入流   获取信息
        FileInputStream fis = new FileInputStream("image.png");
        //输出流   写发送信息
        FileOutputStream fos = new FileOutputStream("image_cp.png");
        int d;//用来记录从源文件读取的字节
        long start =System.currentTimeMillis();
        while ((d = fis.read()) != -1) {
            fos.write(d);
        }
        long end =System.currentTimeMillis();
        System.out.println("复制完毕耗时："+(end-start)+"ms");
        System.out.println("复制完毕！");
        fis.close();
        fos.close();
    }
}
